package com.zb.Service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.zb.Service.LeaveService;
import com.zb.entity.Leave;
import com.zb.mapper.LeaveMapper;

@Component("LeaveService")
public class LeaveServiceImpl implements LeaveService {
	@Autowired
	private LeaveMapper lm;

	public Leave getLeaveById(int id) {

		return lm.getLeaveById(id);
	}

	public List<Leave> getLeaveByUserId(int userId) {

		return lm.getLeaveByUserId(userId);
	}

	public void saveLeave(Leave l) {
		lm.saveLeave(l);
	}

	public void updateLeave(int state, int id) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("state", state);
		params.put("id", id);
		lm.updateLeave(params);
	}

	public int getMaxId() {
		// TODO Auto-generated method stub
		return lm.getMaxId();
	}
	

}